package com.ywm.oss.controller;

import com.ywm.commonUtil.R;
import com.ywm.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



@RestController
@RequestMapping("/eduoss/fileoss")
//@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    @GetMapping("/hello")
    public String hello(){
        return "hello world";
    }
    @PostMapping("/file")
    public R uploadOss(MultipartFile file) {
        String s = ossService.uploadFileAvatar(file);
        System.out.println(s);
        return R.ok().data("url",s);
    }
}
